//
//  UIButton+UIButton_EXtension.m
//  OCweibo
//
//  Created by 郑兆远 on 15/12/22.
//  Copyright © 2015年 zzy. All rights reserved.
//

#import "UIButton+UIButton_EXtension.h"

@implementation UIButton (UIButton_EXtension)
+ (instancetype)buttonWithTitle:(NSString*)title color:(UIColor*)color font:(CGFloat)fontSize backImageName:(NSString*)imageName{
        UIButton *btn = [[self alloc]init];
    if(btn){
        [btn setTitle:title forState:UIControlStateNormal];
        [btn setTitleColor:color forState:UIControlStateNormal];
        btn.titleLabel.font = [UIFont systemFontOfSize:fontSize];
        [btn setBackgroundImage:[UIImage imageNamed:imageName] forState:UIControlStateNormal];
        [btn sizeToFit];
        }
    return  btn;
    }
+ (instancetype)buttonWithTitle:(NSString*)title color:(UIColor*)color backImageName:(NSString*)imageName{
    UIButton *btn = [[self alloc]init];
    if(btn){
        [btn setTitle:title forState:UIControlStateNormal];
        [btn setTitleColor:color forState:UIControlStateNormal];
        [btn setImage:[UIImage imageNamed:imageName] forState:UIControlStateNormal];
        [btn setBackgroundImage:[UIImage imageNamed:[imageName stringByAppendingString:@"_highlighted"]] forState:UIControlStateHighlighted];
        [btn sizeToFit];
    }
    return btn;
}
 @end
